import tool from '@/utils/tool'
import auth from "@/api/model/auth.js"
// 状态
const state = {
  socketTask: null // scoket连接
}


const mutations = {
  WEB_SOCKET_LINK (state, data) {
    state.socketTask = data
  }
}

const actions = {
  // 初始化登录
  async getRefreshToken ({ commit,state }) {
    tool.cookie.remove("TOKEN")
    var result = await auth.refreshToken.post({code: tool.data.get("REFRESHTOKEN")});
    tool.cookie.set("TOKEN",result.data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}